|
|
|
|
|
|
|
Variable Data Type Prefixes |
|
|
|
|
|
|
|
|
Table A.6 defines the standard variable data types in Visual Basic. These prefixes should be used when naming the variables in your program. Avoid the use of the Visual Basic suffixes (%, &, #, and so on) at all costs. |
|
|
|
|
| Table A.6 Variable Type Prefixes. | | Prefix | Data Type | Storage | Example | | bool | Boolean | Two bytes | boolPerform | | byt | Byte | One byte | byteArray | | cur | Currency | Eight bytes | curSales | | int | Integer | Two bytes | intLoop | | dbl | Double | Eight bytes | dblValue | | dt | Date and Time | Eight bytes | dtEntered | | lng | Long | Four bytes | lngEnv | | sgl | Single | Four bytes | sglValue | | str | String | One byte per char | strName | | vnt | Variant | Sixteen bytes plus one byte for each character in a string type | vntAnything | | a | Array | Depends on size | astrName | | typ | User-defined type | Depends on size | typCustomer | | o or obj | Objects | Any object | OConn |
|
|
|
|
|
|
A variables scope refers to the locations within your application that a particular variable may be read or modified. For example, a local variable is one declared within a Sub...End Sub or Function...End Function. This variable may only be read or modified while code is executing within the Sub...End Sub statements. A module-level variable, on the other hand, may be read and modified from any procedure or function within the same module. Global or public variables may be referenced from any procedure or function within the same project. Table A.7 lists the common scope prefixes you should use. |
|
|
|
|
|